<template>
	<view>
		<cu-custom bgColor="bg-blue"  :isBack="true"><block slot="content">报告详情</block></cu-custom>
		<view class="cu-bar bg-white solid-bottom">
			<view class="action">
				<text class="cuIcon-titles text-blue"></text> 基本信息
			</view>
		</view>
		<view class="margin-sm">
			<view class="cu-form-group">
				<view class="title">订单编码</view>
				<view class="basis-regin text-right">{{order.orderNumber}}</view>
			</view>
			<view class="cu-form-group">
				<view class="title">姓名</view>
				<view class="text-right">{{order.submitName}}</view>
			</view>
			<view class="cu-form-group">
				<view class="title">手机号</view>
				<view class="text-right">{{order.submitPhone}}</view>
			</view>
			<view class="cu-form-group"   @tap="showDatePicker">
				<view class="title">送检日期</view>
				<view class="basis-regin text-right">{{order.submitDate}}</view>
			</view>
			<view class="cu-form-group"  @tap="showRegionPicker">
				<view class="title">接收城市</view>
				<view class="basis-regin text-right">{{order.acceptRegName}}</view>
			</view>
			<view class="cu-form-group" @tap="acceptUserShow">
				<view class="title">接收员</view>
				<view class="basis-regin text-right">{{order.acceptUserName}}</view>
			</view>
		</view>
		<view class="cu-bar bg-white solid-bottom">
			<view class="action">
				<text class="cuIcon-titles text-blue"></text> 样品列表
			</view>
		</view>
		<view class="margin-sm">
			<view v-for="(item,index) in order.orderDetail" :key="index" class="padding-bottom-sm">
				<view class="bg-gray"></view>
				<view class="cu-form-group" @click="simpleTypeShow(index)">
					<view class="title">样品种类</view>
					<view class="basis-regin text-right">
						{{item.simpleTypeName}}
					</view>
				</view>
				<view class="cu-form-group">
					<view class="title">样品编号</view>
					<view class="basis-regin text-right">
						<text>{{item.orderNumber}}</text>
					</view>
				</view>
				<view class="cu-form-group">
					<view class="title">原始编码</view>
					<view class="basis-regin text-right">
						<text>{{item.originalCode?item.originalCode:""}}</text>
					</view>
				</view>
				<view class="cu-form-group">
					<view class="title">状态</view>
					<view class="basis-regin text-right">
						<text v-if="item.state==10" class="text-red">未受理</text>
						<text v-if="item.state==20" class="text-blue">已受理</text>
						<text v-if="item.state==30" class="text-blue">待确认</text>
						<text v-if="item.state==40" class="text-blue">待付款</text>
						<button v-if="item.state==50" class="cu-btn bg-green shadow-blur sm" @tap="goReport(item)">样品报告（已付款）</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { getOrder} from '@/api/modules/order.js'
	export default {
		data() {
			return {
				orderId:"",
				order:{}
			}
		},
		onLoad(options) {
			this.orderId=options.orderId
		},
		onReady() {
			this.getOrderDetail()
		},
		methods: {
			getOrderDetail(){
				let self=this
				getOrder(this.orderId).then(res=>{
					if(res.data.code==200){
						console.log(res.data.data)
						self.order=res.data.data
					}
				})
			},
			goReport(item){
				uni.navigateTo({
					url:"../../mine/acceptOrderDetailReport/acceptOrderDetailReport?orderDetailId="+item.orderDetailId
				})
			}
			
		}
	}
</script>

<style>
page{
	background-color: #f0f0f0;
}
</style>
